x86emul: complete decoding of two-byte instructions
authorJan Beulich <jbeulich@suse.com>
Thu, 29 Sep 2016 10:03:12 +0000 (12:03 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 29 Sep 2016 10:03:12 +0000 (12:03 +0200)
commit93ff47cf9fdc191a7516214325a7b903f3559567
tree9e907e35e9518f266067da9496248971a6572699
parent0552a8cfda43e4c14f86fee357b5cb354e433acd
x86emul: complete decoding of two-byte instructions

This way we can at least size (and e.g. skip) them if needed, and we
also won't raise the wrong fault due to not having read all relevant
bytes.

This at once adds correct raising of #UD for the three "ud<n>" flavors
(Intel names only "ud2", but AMD names all three of them in their
opcode maps), as that may make a difference to callers compared to
getting back X86EMUL_UNHANDLEABLE.

Note on opcodes 0FA6 and 0FA7: These are VIA's PadLock instructions,
which have a ModRM like byte where only register forms are valid. I.e.
we could also use SrcImmByte there, but ModRM is more likely to be
correct for a hypothetical extension allowing non-register operations.

Note on opcode 0FB8: I think we're safe to ignore the Itanium specific
JMPE (which doesn't take a ModRM byte, but an immediate).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/x86_emulate/x86_emulate.c